// mircoApp/customCluster/customUser/customUser.js
const app = getApp();
const skinBehavior = require("../../../utils/themeSkin/skinBehavior");
Page({
  behaviors: [skinBehavior],
  /**
   * 页面的初始数据
   */
  data: {
    imgPath: app.globalData.imgPath,
    info:{},
    usableLove:'',
    navLists:[
      {
        img: app.globalData.imgPath + 'plugin/customCluster/detail.png',
        title:'明细',
        api:'plugin.customized-group.frontend.controllers.records.index',
        navTo:'/mircoApp/shop_base/reward_template/index'
      },
      {
        img:app.globalData.imgPath + 'plugin/customCluster/Donation.png',
        title:'转赠',
        api:'',
        navTo:'/packageB/member/love/love_transfer/love_transfer'
      },
      {
        img:app.globalData.imgPath + 'plugin/customCluster/record.png',
        title:'参与记录',
        api:'',
        navTo:'/mircoApp/customCluster/takeList/takeList'
      },
      {
        img:app.globalData.imgPath + 'plugin/customCluster/polyIndex.png',
        title:'聚合页',
        api:'',
        navTo:'/mircoApp/customCluster/polyIndex/polyIndex'
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.myIndex();
  },
  goodsNav() {

  },
  menuNav(event) {
    let {navto,api} = event.currentTarget.dataset;
    if(navto && !api) {
      wx.navigateTo({
        url: navto
      });
    }
    if(api && navto) {
      wx.navigateTo({
        url: `${navto}?api=${api}`
      });
    }
  },
  menuTeam() {
    wx.navigateTo({
      url: '/mircoApp/customCluster/statistics/statistics'
    });
  },
  myIndex() { //会员信息
    let urlStr = app.getNetAddresss("plugin.customized-group.frontend.controllers.index.my-page");
    app._postNetWork({
      url: urlStr,
      data: {basic_info:1},
      success: (resdata) => {
        var res = resdata.data;
        let data = res.data;
        if (res.result == 1) {
          this.setData({
            info:data,
            usableLove:res.basic_info?.plugin_setting?.love?.usable_love_name
          })
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})